package com.kaibes.module.user.pojo;

import java.time.LocalDate;
import java.time.LocalDateTime;

import com.kaibes.core.base.annotation.Description;
import com.kaibes.core.validator.NotBlankButNull;
import com.kaibes.module.user.GenderEnum;

import lombok.Data;

/**
CREATE TABLE `user` (
  `id` integer NOT NULL AUTO_INCREMENT,
  `role_id` smallint unsigned DEFAULT NULL,
  `image` mediumtext,
  `name` varchar(16) DEFAULT '',
  `nickname` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `gender` enum('UNKNOWN','MALE','FEMAL') NOT NULL DEFAULT 'UNKNOWN',
  `birth` date NOT NULL,
  `address` varchar(128) DEFAULT NULL,
  `introduction` tinytext NOT NULL,
  `login_time` datetime DEFAULT NULL,
  `logout_time` datetime DEFAULT NULL,
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `nickname` (`nickname`),
  KEY `role_id` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 */
@Data
@Description("用户信息")
public class User {
    @Description("用户ID")
    private Integer id;
    @Description("角色ID")
    private Integer roleId;
    @Description("头像路径")
    private String image;
    @Description("名字")
    private String name;
    @Description("昵称")
    @NotBlankButNull(message = "用户昵称不能为空")
    private String nickname;
    @Description("性别")
    private GenderEnum gender = GenderEnum.FEMAL;
    @Description("生日")
    private LocalDate birth = LocalDate.now();
    @Description("地址")
    private String address;
    @Description("个人介绍")
    private String introduction;
    @Description("登录时间")
    private LocalDateTime loginTime;
    @Description("登出时间")
    private LocalDateTime logoutTime;
    @Description("创建时间")
    private LocalDateTime createTime;
    @Description("更新时间")
    private LocalDateTime updateTime;
}
    